/* 
登陆账号请求
 */
import store from "@/store"
import request from "@/utils/request"

// 手机+密码
export const loginbyphoneAPI = (phone, md5_password) => {
  let realIP = store.state.realIP
  return request({
    method: "GET",
    url: "/login/cellphone",
    params: {
      phone,
      md5_password,
      realIP
    },
  })
}
// 手机+验证码
export const loginbyctcodeAPI = (phone, captcha) => {
  let realIP = store.state.realIP
  return request({
    method: "GET",
    url: "/login/cellphone",
    params: {
      phone,
      captcha,
      realIP
    },
  })
}
//发送验证码
export const getctcodeAPI = (phone) => {
  return request({
    method: "GET",
    url: "/captcha/sent",
    params: {
      phone,
    },
  })
}

// 邮箱+密码
export const loginbyemailAPI = (email, password) => {
  let realIP = store.state.realIP
  return request({
    method: "GET",
    url: "/login/cellphone",
    params: {
      email,
      password,
      realIP
    },
  })
}

//获取二维码key
export const getqrkeyAPI = () => {
  return request({
    method: "GET",
    url: "/login/qr/key",
    params: { timestamp: Date.now() },
  })
}
//获取二维码
export const getqrAPI = (key) => {
  return request({
    method: "GET",
    url: "/login/qr/create",

    params: { key, qrimg: true, timestamp: Date.now() },
  })
}
//二维码检测扫码状态接口
export const getqrcheckAPI = (key) => {
  return request({
    method: "GET",
    url: "/login/qr/check",
    params: { key, timestamp: Date.now() },
  })
}
//游客登录
export const loginbyanonimousAPI = () => {
  return request({
    method: "GET",
    url: "/register/anonimous",
  })
}

//获取登录状态
export const loginstatusAPI = () => {
  let cookie = store.state.usercookie
  return request({
    method: "GET",
    url: "/login/status",
    params: {
      cookie,
    },
  })
}

//获取登录状态
export const loginstatusbynothingAPI = () => {

  return request({
    method: "GET",
    url: "/login/status",

  })
}
